﻿using Domain.Entity;
using DtoFw;
using Repository.Base;
using Util;

namespace Repository
{
    public class MainUserMapRoleRepository : BaseRepository<MainUserMapRoleEntity>
    {
        private readonly SnowFlakeGenerator worker;
        public MainUserMapRoleRepository(SnowFlakeGenerator snowFlakeGenerator) : base(snowFlakeGenerator)
        {
            this.worker = snowFlakeGenerator;
        }
        public MainUserMapRoleEntity Get(int userid)
        {
            return base.Get(new BaseQuery() { }, linq =>
            {
                linq = linq.Where(x => x.IsDeleted == false);
                if (userid > 0)
                    linq = linq.Where(x => x.UserId == userid);

                return linq;
            });

        }
    }
}
